package mvcdemo.controller;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/pic")
public class PicController {

	@RequestMapping("/real")
	public void getPic(String path,OutputStream os) throws IOException{
		File file=new File(path);
		FileInputStream fis=new FileInputStream(file);
		byte[] buff=new byte[2048];
		int len=-1;
		while((len=fis.read(buff))!=-1){
			os.write(buff,0,len);
		}
	}
}
